package kr.lgh.sms_creditcard.BankType;

import java.util.ArrayList;

import kr.lgh.sms_creditcard.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class CustomAdapter extends BaseAdapter {

	Context context;
	LayoutInflater inflater;
	ArrayList<BankInfo> lists = new ArrayList<BankInfo>();
	TextView t_date, t_money, t_place, t_card;

	public CustomAdapter(Context context, ArrayList<BankInfo> kb_list) {
		inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.context = context;
		this.lists = kb_list;
	}

	@Override
	public int getCount() {
		return lists.size();
	}

	@Override
	public Object getItem(int position) {
		return lists.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		if (convertView == null) {
			convertView = inflater.inflate(R.layout.row2, parent, false);
		}
		t_date = (TextView) convertView.findViewById(R.id.t_date);
		t_money = (TextView) convertView.findViewById(R.id.t_money);
		t_place = (TextView) convertView.findViewById(R.id.t_place);
		t_card = (TextView) convertView.findViewById(R.id.t_card);

		t_date.setText(lists.get(position).getS_date() + "\n"
				+ lists.get(position).getS_time());
		t_money.setText(lists.get(position).getS_money() + "원");
		t_place.setText(lists.get(position).getS_place());
		t_card.setText(lists.get(position).getS_card());

		return convertView;
	}

}
